<%-- 
    Document   : editEmployee
    Created on : Dec 18, 2009, 9:28:59 AM
    Author     : Administrator
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib  prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib  prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<script type="text/javascript" src="<%=request.getContextPath()%>/datepicker/js/datepicker.yuic.js">
</script>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/datepicker/css/datepicker.css"/>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<form method="post">
    <table border="1">
        <tr>
            <th colspan="2"><c:if test="${employee.autoId==0}">Create new employee</c:if>
                <c:if test="${employee.autoId!=0}">Edit employee: ${employee.fullname}</c:if></th>

        </tr>
        <c:if test="${msg!=null}">
            <tr>
                <td colspan="2" style="font-style:italic; color:red;">${msg}</td>
            </tr>
        </c:if>

        <c:if test="${employee.autoId==0}">
            <tr>
                <td>Username: </td>
                <td><input type="text" name="username" value="${employee.username}" /></td>
            </tr>
        </c:if>
        <tr>
            <td>Password: </td>
            <td><input type="password" name="password" value="${employee.password}" /></td>

        </tr>
        <tr>
            <td>Password again: </td>
            <td>
                <c:if test="${passwordAgain!=null}">
                    <input type="password" name="passwordAgain" value="${passwordAgain}" />
                </c:if>
                <c:if test="${passwordAgain==null}">
                    <input type="password" name="passwordAgain" value="${employee.password}" />
                </c:if>
            </td>
        </tr>
        <tr>
            <td>Full name: </td>
            <td><input type="text" name="fullname" value="${employee.fullname}" /></td>
        </tr>
        <tr>
            <td>Sex: </td>
            <td><select size="1" name="sex">
                    <option value="UNKNOWN" <c:if test="${employee.sex=='UNKNOWN'}">selected</c:if>>Unknown</option>
                    <option value="MALE" <c:if test="${employee.sex=='MALE'}">selected</c:if>>Male</option>
                    <option value="FEMALE" <c:if test="${employee.sex=='FEMALE'}">selected</c:if>>Female</option>
                </select></td>
        </tr>
        <tr>
            <td>Birthday: </td>
            <td>
                <select id="dateOfBirth-dd" name="dateOfBirth-dd">
                    <c:forEach var="date" begin="1" end="31" step="1">
                        <option value="${date}" ${date==employee.dateOfBirth.date?"selected":""}>${class.sgt.supermarket.util.DateExtensions.getDateString$[date]}</option>
                    </c:forEach>

                </select>
                <select id="dateOfBirth-mm" name="dateOfBirth-mm">
                    <c:forEach var="month" begin="1" end="12" step="1">
                        <option value="${month}" ${month==employee.dateOfBirth.month+1?"selected":""}>${class.sgt.supermarket.util.DateExtensions.getMonthString$[month]}</option>
                    </c:forEach>
                </select>
                <c:set var="now" value="${class.java.util.Date.new$0}"/>
                <select class="split-date range-low-19000101 range-high-${now.year+1900}0101" id="dateOfBirth" name="dateOfBirth">
                    <c:forEach var="year" begin="1900" end="${now.year+1900}" step="1">
                        <option value="${year}" ${year==employee.dateOfBirth.year+1900?"selected":""}>${year}</option>
                    </c:forEach>
                </select>
            </td>
        </tr>
        <tr>
            <td>Enabled: </td>

            <td><input type="checkbox" name="enabled"  <c:if test="${employee.enabled}">checked</c:if></td>
        </tr>
        <tr>
            <td colspan="2"><input type="submit" value="Submit"/></td>
        </tr>

    </table>
</form>
